package com.dm.shop.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dm.shop.entity.ProductImage;
import com.dm.shop.service.ProductImageService;
import com.dm.shop.utils.ResultUtil;
import com.dm.shop.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author MyBatisPlusGenerater-Saiya Wang
 * @since 2021-07-20
 */
@CrossOrigin
@RestController
@RequestMapping("/productImage")
public class ProductImageController {
    @Autowired
    private ProductImageService productImageService;
    @GetMapping("/{pid}")
    public Result getImgById(@PathVariable int pid){
        QueryWrapper<ProductImage> wrapper=new QueryWrapper<>();
        wrapper.eq("pid",pid);
        List<ProductImage> productImages=productImageService.list(wrapper);
        return ResultUtil.success(productImages);
    }

}
